home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Games
/
NeXTmj
/
Source
/
Tile.cc
< prev
next >
Wrap
Text File
|
1994-04-27
|
1KB
|
77 lines
/*
$Author$
$Header$
*
$Log$
*/
#import "Tile.h"
extern "Objective-C" {
#import <defaults/defaults.h>
#import <dpsclient/psops.h>
}
extern "C" {
#import <assert.h>
#import <libc.h>
#import <string.h>
}
// This is a subdirectory within
// the application where the tile
// tiff images are stored.
#define TILE_TIFF_DIRECTORY "NeXTmj-tiff"
Tile::Tile( void ) {
my_tile_image = nil;
}
Tile::~Tile( void ) {
[ my_tile_image free ];
}
void Tile::loadImageFromFile( const char* aFile ) {
char *buf = alloca( strlen( NXArgv[ 0 ] ) + + strlen( TILE_TIFF_DIRECTORY ) + strlen( aFile ) + 8 ),
*ptr;
// Build a full path file name.
strcpy( buf, NXArgv[ 0 ] );
if( ptr = strrchr( buf, '/' ))
*( ptr + 1 ) = '\0';
strcat( buf, TILE_TIFF_DIRECTORY"/" );
strcat( buf, aFile );
// Allocate and initialize
// a tiff image.
my_tile_image = [[ NXImage alloc ] initFromFile:buf ];
assert( my_tile_image );
}
void Tile::compositeImage( NXPoint aPoint, int aMode ) {
NXRect r;
assert( my_tile_image );
r.origin = aPoint;
[ my_tile_image getSize:&r.size ];
PSsetgray( NX_DKGRAY );
NXRectFill( &r );
[ my_tile_image composite:aMode toPoint:&aPoint ];
}